﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections;
using umbraco.DataLayer;
using umbraco.BusinessLogic;
using umbraco.editorControls;
using System.Collections.Generic;
using System.Data.SqlClient;
using umbraco.NodeFactory;
using System.Web.SessionState;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic.property;
using umbraco.interfaces;
using ExtendedWorkFlow.Helpers;
using ExtendedWorkFlow.Commands;


namespace ExtendedWorkFlow
{
    
    public class Group : Node
    {

        #region Variables

        State _SaveState;
        State _ToPublishState;

        #endregion

        #region Constructor

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="GroupId">GroupId of WorkFlow</param>                
        public Group(int GroupId) : base(GroupId)
        {
            if (this.Properties["toPublishState"] != null)
                this._ToPublishState = new State(Functions.ToInt(this.Properties["toPublishState"].Value));
            if (this.Properties["saveState"] != null)
                this._SaveState = new State(Functions.ToInt(this.Properties["saveState"].Value));
        }

        #endregion

        #region Properties

        /// <summary>
        /// If the user has clicks ToPublish while still in a workflow the workflow can be redirected to a new state before being cancelled
        /// </summary>
        public State ToPublishState { get { return this._ToPublishState; } }

        /// <summary>
        /// If the user has clicks Save while still in a workflow the workflow can be redirected to a new state before being cancelled
        /// </summary>
        public State SaveState { get { return this._SaveState; } }

        #endregion

    }

}